<?php
/**
 * @author tungck
 * @filesource event.php
 * quan ly sự kiện 
*/

class Event extends CI_Controller{
    public $mahoso;
    function __construct(){
        
        parent::__construct();
        $this->load->helper('url');
        $this->load->library(array('form_validation','session'));
        $this->load->library('userlayout');
        $this->userlayout->setLayout("user/layout");
        $userSession = $this->session->userdata('user');
        if($userSession['username'] == false){
            redirect(base_url('/index/login?returnUrl=').urlencode(RETURN_URL));
            
        }
    }
     function index(){
        $this->list_event();
     }
    
    function list_event(){
        $data['startIndex'] = 0;
        $data['pageSize'] = 10;
        $this->load->model("user/event_model");
        $result = $this->event_model->getList($data);
        $numberRecord = $result['recordCount'];
        $data['record'] = $result['query'];    
        $title = "Trang chủ";
        $currTemp = array('&nbsp;&nbsp; Tin Tức');
        $current['current'] = $currTemp;
        $this->userlayout->view("user/list_event",$data,$title, $current );
    }
    
    function detail_event(){
        $id = $_GET['id'];
        $title = "Trang chủ";
        $this->load->model("user/event_model");
        $result = $this->event_model->getById($id);
        $data['record'] = $result;
        $currTemp = array('&nbsp;&nbsp;<a href= "'.base_url('nhanvien/event/list_event').'">Tin Tức</a> &raquo; Chi Tiết');
        $current['current'] = $currTemp;
        $this->userlayout->view("user/detail_event",$data,$title, $current );
    }
    
}

?>

